{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "OPENQASM 2.0;\n",
      "include \"qelib1.inc\";\n",
      "qreg q[5];\n",
      "creg c[5];\n",
      "h q[2];\n",
      "h q[3];\n",
      "h q[4];\n",
      "cx q[2],q[1];\n",
      "cx q[2],q[0];\n",
      "h q[3];\n",
      "cu1(1.570796326794897) q[3],q[4];\n",
      "h q[4];\n",
      "cu1(0.785398163397448) q[3],q[2];\n",
      "cu1(1.570796326794897) q[4],q[2];\n",
      "h q[2];\n",
      "measure q[2] -> c[2];\n",
      "measure q[3] -> c[3];\n",
      "measure q[4] -> c[4];\n",
      "\n"
     ]
    }
   ],
   "source": [
    "# Checking the version of PYTHON; we only support > 3.5\n",
    "import sys\n",
    "if sys.version_info < (3,5):\n",
    "    raise Exception('Please use Python version 3.5 or greater.')\n",
    "    \n",
    "# Importing QISKit\n",
    "import math\n",
    "from qiskit import QuantumCircuit, QuantumProgram\n",
    "import Qconfig\n",
    "\n",
    "# Import basic plotting tools\n",
    "from qiskit.tools.visualization import plot_histogram\n",
    "\n",
    "# Quantum program setup \n",
    "Q_program = QuantumProgram()\n",
    "Q_program.set_api(Qconfig.APItoken, Qconfig.config[\"url\"]) # set the APIToken and API url\n",
    "q = Q_program.create_quantum_register(\"q\", 5)\n",
    "c = Q_program.create_classical_register(\"c\", 5)\n",
    "\n",
    "\n",
    "shor11_15 = Q_program.create_circuit(\"shor11_15\", [q], [c])\n",
    "shor11_15.h(q[2])\n",
    "shor11_15.h(q[3])\n",
    "shor11_15.h(q[4])\n",
    "\n",
    "shor11_15.cx (q[2],q[1])\n",
    "shor11_15.cx (q[2],q[0])\n",
    "shor11_15.h (q[3])\n",
    "shor11_15.cu1(math.pi/2.0, q[3], q[4])\n",
    "shor11_15.h (q[4])\n",
    "shor11_15.cu1(math.pi/4.0, q[3], q[2])\n",
    "shor11_15.cu1(math.pi/2.0, q[4], q[2])\n",
    "shor11_15.h (q[2])\n",
    "\n",
    "\n",
    "for i in range(2,5):\n",
    "    shor11_15.measure(q[i], c[i])\n",
    "print(shor11_15.qasm())\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "%matplotlib inline\n",
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "def plot_histogramH(data, number_to_keep=False):\n",
    "    \"\"\"Plot a histogram of data.\n",
    "\n",
    "    data is a dictionary of  {'000': 5, '010': 113, ...}\n",
    "    number_to_keep is the number of terms to plot and rest is made into a\n",
    "    single bar called other values\n",
    "    \"\"\"\n",
    "    if number_to_keep is not False:\n",
    "        data_temp = dict(Counter(data).most_common(number_to_keep))\n",
    "        data_temp[\"rest\"] = sum(data.values()) - sum(data_temp.values())\n",
    "        data = data_temp\n",
    "\n",
    "    labels = sorted(data)\n",
    "    values = np.array([data[key] for key in labels], dtype=float)\n",
    "    pvalues = values / sum(values)\n",
    "    numelem = len(values)\n",
    "    ind = np.arange(numelem)  # the x locations for the groups\n",
    "    width = 0.35  # the width of the bars\n",
    "    fig, ax = plt.subplots()\n",
    "    rects = ax.bar(ind, pvalues, width, color='seagreen')\n",
    "    # add some text for labels, title, and axes ticks\n",
    "    ax.set_ylabel('Probabilities', fontsize=12)\n",
    "    ax.set_xticks(ind)\n",
    "    ax.set_xticklabels(labels, fontsize=12, rotation=70)\n",
    "    ax.set_ylim([0., min([1.2, max([1.2 * val for val in pvalues])])])\n",
    "    # attach some text labels\n",
    "    for rect in rects:\n",
    "        height = rect.get_height()\n",
    "        ax.text(rect.get_x() + rect.get_width() / 2., 1.05 * height,\n",
    "                '%4.3f' % float(height),\n",
    "                ha='center', va='bottom')\n",
    "    plt.show()\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSU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VjV/qtIY8w/U0S+ihwNn9MZe0d2VjOPdG+KpaSzm/14fe7G\nAtINmNZFsSuiNnzOHmS8j9Tx2+jHsiFytmsqOkC9ZJX570mdu7+S9AjpA+TnpCFmU4CTC4wIlCOn\nM/aaIcB1pNuz3gfck30TP4g0cm1f4F2kjt8ilSFndxn3o/iMUJ6cwAA6g6gk6WDgeNK16N1JHxrz\nowGWrqhUhpzO+Obp9UXlqu+fPA34akTsUmC8DmXIWYaMUKKcA7FAVMqG7A2JBrlncmfKkNMZe0f7\nh4akL5EmSv1D0ZnylCFnGTJC4+Yc8AXCrFFJGgq8GI2/2mjD5yxDRmi8nC4QZmaWayANczUzsxq4\nQJiZWS4XCDMzy+UCYWZmuVwgzMwslwuEmZnl+l91rRN31lFE3gAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x1136f02b0>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "simulate = Q_program.execute([\"shor11_15\"], backend=\"local_qasm_simulator\", shots=1024)\n",
    "result = simulate.get_counts(\"shor11_15\")\n",
    "#plot_histogramH(result)\n",
    "plot_histogramH({'00000': 486, '00100': 514,'10000': 0,'01000': 0,'01100': 0,'11000': 0,'10100': 0,'11100': 0})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAY8AAAEaCAYAAADpMdsXAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3Xt8VOW97/HPD0KoUBQVopiAwA7XhIuaAHrc4o1rbRRs\nNd5rpOxQ3GqtVc7e+/TsXmVbbUGhUrwVRUntlhqOAgUtKtRCglS8oAIbqCRFEVDxjom/88eajJMY\nyCySzAW+79crL2bWJfOdBcxv1rOe9Tzm7oiIiITRJtkBREQk/ah4iIhIaCoeIiISmoqHiIiEpuIh\nIiKhqXiIiEhoKh4iIhKaioeIiISm4iEiIqFlJDtAa+nSpYv37Nkz2TFERNLGCy+8sMvdu8az7SFb\nPHr27MnatWuTHUNEJG2Y2d/j3VbNViIiEpqKh4iIhKbiISIioal4iIhIaCoeIiISmoqHiIiEpuIh\nIiKhqXiIiEhoKh4iIhKaioeIiISm4iEiIqGpeIiISGgqHiIiEpqKh4iIhKbiISIioal4iIhIaCoe\naWDp0qX069eP3Nxcpk+f/pX1Dz/8MIMHD2bQoEGcdtpprF+/vt762tpaTjrpJM4777x6y++66y76\n9+9PXl4eN998c6u+BxE5tByyMwkeKmpra5k6dSrLly8nJyeHwsJCioqKGDhwYHSbXr168eyzz3L0\n0UezZMkSJk+ezJo1a6LrZ86cyYABA9i7d2902YoVKygvL2f9+vW0b9+enTt3JvR9iUh605lHiquo\nqCA3N5fevXuTmZlJcXEx5eXl9bY57bTTOProowEYMWIEVVVV0XVVVVU8+eSTTJo0qd4+d999N9Om\nTaN9+/YAZGVltfI7EZFDiYpHiquurqZ79+7R5zk5OVRXV+93+/vuu49x48ZFn99www3cdttttGlT\n/69648aNrFy5kuHDhzNy5EgqKytbPryIHLLUbHUIWbFiBffddx+rVq0C4IknniArK4tTTjmFZ555\npt62NTU17Nmzh9WrV1NZWclFF13Eli1bMLMkJBeRdKMzjxSXnZ3N9u3bo8+rqqrIzs7+ynYvvfQS\nkyZNory8nGOPPRaAv/zlLyxatIiePXtSXFzMn//8Zy6//HIgOIOZOHEiZsawYcNo06YNu3btSsyb\nEpG0p+KR4goLC9m0aRNbt25l3759lJWVUVRUVG+bN998k4kTJ/LQQw/Rt2/f6PJbb72Vqqoqtm3b\nRllZGWeffTbz588H4IILLmDFihVA0IS1b98+unTpkrg3JiJpTc1WKS4jI4NZs2YxZswYamtrKSkp\nIS8vjzlz5gBQWlrKT37yE3bv3s33vve96D5r16494O8tKSmhpKSE/Px8MjMzmTdvnpqsRCRu5u7J\nztAqCgoKvKkPUBER+ZKZveDuBfFsq2YrEREJTcV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xoYxkB0gFkar+bwQXm/9mZi8RfLj8maCrXBHwrSRGVMYWlCY5\nM4F5BNP2/hVYFfkWfxJBL7v+wOkEF6KTJR0yQtM5B5D8nOmQsR6deTRgZicD5xO0fXcj+EBZ6ikw\n5EcdZWw5qZ7TvhzAr+F825OBW9392CTGq8uS8hkhPXKmQ8Y6Kh4HEOl6mOkpNM92Q8rYctIhZ92H\nipn9lOBGsX9PdqaG0iEjpEfOVM6o4iGShsysC/CRp/aorymfEdIjZypmVPEQEZHQ1FVXRERCU/EQ\nEZHQVDxERCQ0FQ8REQlNxUNEREJT8RARkdD+P1+S/ciYb+dlAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x114dbe048>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "ibmqx_backend = Q_program.get_backend_configuration('ibmqx4')\n",
    "ibmqx_coupling = ibmqx_backend['coupling_map']\n",
    "\n",
    "result = Q_program.execute([\"shor11_15\"], backend=\"ibmqx4\", coupling_map=ibmqx_coupling, shots=1024, max_credits=3, wait=10, timeout=240)\n",
    "plot_histogramH(result.get_counts(\"shor11_15\"))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "ibmqx_backend = Q_program.get_backend_configuration('ibmqx5')\n",
    "ibmqx_coupling = ibmqx_backend['coupling_map']\n",
    "\n",
    "result = Q_program.execute([\"shor11_15\"], backend=\"ibmqx5\", coupling_map=ibmqx_coupling, shots=1024, max_credits=3, wait=10, timeout=240)\n",
    "print(result.get_ran_qasm(\"shor11_15\"))\n",
    "plot_histogramH(result.get_counts(\"shor11_15\"))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "anaconda-cloud": {},
  "kernelspec": {
   "display_name": "Python [Root]",
   "language": "python",
   "name": "Python [Root]"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.5.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
